
using System;
using System.Data;

using stefc.geo.lib;

namespace stefc.geo.data.model
{
		
	public class PointOfInterest : Entity
	{
		private int id;
		private string name;
		private Geographic location;
		private int color;

		public static PointOfInterest Create(string name, Geographic location, int color)
		{
			PointOfInterest result = new PointOfInterest();
			result.Name=name;
			result.Location=location;
			result.Color=color;
			return result;
		}
		
		private PointOfInterest():base()
		{
		}
		
		public PointOfInterest(IDataReader reader):this()
		{
			int ord=reader.GetOrdinal("Id");
			this.id=reader.GetInt32(ord);
			ord=reader.GetOrdinal("Name");
			if(!reader.IsDBNull(ord))
				this.name=reader.GetString(ord);
			ord=reader.GetOrdinal("Location");
			if(!reader.IsDBNull(ord))
				this.location=new Geographic(reader.GetString(ord));
			ord=reader.GetOrdinal("Color");
			if(!reader.IsDBNull(ord))
				this.color=reader.GetInt32(ord);
		}
		
		public int Id
		{
			get { return this.id; }
			internal set { this.id = value; }
		}
		
		public string Name
		{
			get { return this.name; }
			set { 
				if(value!=this.name)
				{
					this.name=value;
					this.Modifiy();
				}
			}
		}
		
		public Geographic Location
		{
			get { return this.location; }
			set { 
				if(value!=this.location)
				{
					this.location=value;
					this.Modifiy();
				}
			}
		}
		
		public int Color
		{
			get { return this.color; }
			set { 
				if(value!=this.color)
				{
					this.color=value;
					this.Modifiy();
				}
			}
		}
	}
}
